<template>
  <div class="wrap">
    <div class="total-wrap">
      <div class="total-item">
        <div class="total-count red">{{ violations.today }}</div>
        <div class="total-desc">今日违规数</div>
      </div>
      <div class="total-item">
        <div class="total-count yellow">{{ violations.month }}</div>
        <div class="total-desc">本月违规数</div>
      </div>
    </div>
    <div class="event-title">今日违规数</div>
    <div style="height: 10rem; overflow-y: auto;">
      <el-table
        :data="violations.todayViolations"
        style="width: 100%"
        :cell-style="{borderBottom: '1px solid #061021'}"
      >
        <el-table-column prop="index" label="NO." width="80">
          <template slot-scope="scope">{{scope.$index+1}}</template>
        </el-table-column>
        <el-table-column prop="roomNo" label="位置">
          <span slot-scope="scope">{{scope.row.roomNo}}</span>
        </el-table-column>
        <el-table-column prop="time" label="时间" width="160">
          <span slot-scope="scope">{{scope.row.time}}</span>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>
<script>
import { getViolations } from "@/api/home/home";
export default {
  name: "MalignantLoad",
  data() {
    return {
      tableData: [
        {
          name: "A区308",
          address: "2024-04-02 18:30:30"
        },
        {
          name: "A区308",
          address: "2024-04-02 18:30:30"
        },
        {
          name: "A区308",
          address: "2024-04-02 18:30:30"
        },
        {
          name: "A区308",
          address: "2024-04-02 18:30:30"
        },
        {
          name: "A区308",
          address: "2024-04-02 18:30:30"
        },
        {
          name: "A区308",
          address: "2024-04-02 18:30:30"
        }
      ],
      violations: {}
    };
  },
  created() {
    this.getData();
  },
  methods: {
    getData() {
      getViolations().then(response => {
        this.violations = response.data;
      });
    }
  }
};
</script>
<style lang="scss" scoped>
.wrap {
  .total-wrap {
    width: 100%;
    margin: 1.25rem 0;
    display: flex;
    justify-content: center;
    .total-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin: 0 2.1875rem;
      .total-count {
        width: 5rem;
        height: 3.875rem;
        margin-bottom: 0.25rem;
        font-family: Microsoft YaHei, Microsoft YaHei;
        font-weight: bold;
        font-size: 1rem;
        color: #ffffff;
        text-align: center;
        line-height: 3.875rem;
      }
      .red {
        background-image: url("../../../assets/images/Events1.png");
        background-size: 100% 100%;
      }
      .yellow {
        background-image: url("../../../assets/images/Events2.png");
        background-size: 100% 100%;
      }
      .total-desc {
        font-family: Microsoft YaHei, Microsoft YaHei;
        font-weight: 400;
        font-size: 0.875rem;
        color: rgba(255, 255, 255, 0.8);
      }
    }
  }
  .event-title {
    width: 25.625rem;
    height: 1.875rem;
    background-image: url("../../../assets/images/wireframe.png");
    background-size: 100% 100%;
    text-align: center;
    line-height: 1.875rem;
    color: #ffffff;
    font-family: Microsoft YaHei, Microsoft YaHei;
    font-weight: 400;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
  }
  .el-table::before {
    background-color: #061021;
  }
  ::v-deep .el-table .el-table__header-wrapper th,
  .el-table .el-table__fixed-header-wrapper th {
    background-color: #17364c;
    color: #fff;
    height: 2.25rem;
    border-bottom: 0;
  }
  ::v-deep .el-table--medium .el-table__cell {
    padding: 0 0;
  }
  ::v-deep .el-table__row {
    height: 2.25rem;
    background-color: #0b1d30;
    font-size: 1rem;
    color: #fff;
  }
  ::v-deep .el-table__empty-block {
    background-color: #0b1d30 !important;
  }
  ::v-deep .el-table__empty-text {
    color: #fff !important;
    font-size: 0.875rem;
  }
  ::v-deep .el-table .el-table__header-wrapper th, .el-table .el-table__fixed-header-wrapper th {
    font-size: 0.87rem;
  }
}
</style>